package web.Permission;

import com.google.gson.Gson;
import entity.PermissionBean;
import services.PermissionServiceAll;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/GetPermsOne")
public class GetPermsOne extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        resp.setContentType("application/json");
        int Uid = Integer.parseInt(req.getParameter("Uid"));
        PermissionServiceAll permissionServiceAll = new PermissionServiceAll();
        PermissionBean one = permissionServiceAll.one(Uid);
        Gson gson = new Gson();
        String json = gson.toJson(one);
        resp.getWriter().println(json);
    }
}
